<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head th:include="common">
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table id="recycleTable"></table>
</body>
<script>

    $(function(){
        queryMap();
    })
    function queryMap(){
        $("#recycleTable").bootstrapTable({
            url:"/goodsConsummer/recycleSelectMap",
            columns:[
                {field:"goodsCheckbox",checkbox:true},
                {field:"goodsName",title:"商品名称"},
                {field:"goodsStartTime",title:"开始时间"},
                {field:"goodsEndTime",title:"结束时间"},
                {field:"goodsPutTime",title:"上架时间"},
                {field:"goodsAdress",title:"详细地址"},
                {field:"goodsMainActor",title:"主要演员"},
                {field:"goodsDuration",title:"演出时长"},
                {field:"goodsImg",title:"商品图片",
                    formatter:function(value,row){
                        return "<img src='"+value+"'  style='width:50px;height:50px'/>"
                    }
                },
                {field:"caoz",title:"操作",
                    formatter:function(value,row){

                            return  "<a href='javascript:updateUpGoods("+row.goodsId+")'>恢复</a> |"+
                                "<a href='javascript:deleteThisGoods("+row.goodsId+")'>删除</a> "
                        /*onclick="updateUpGoods('+row.goodsId+')*/

                    }
                }
            ],
            pagination:true,
            pageSize:10,
            pageList:[10,15],
            sidePagination:'server',
        })
    }
    /*上架*/
    function updateUpGoods(goodsId){
        $.ajax({
            url:"/goodsConsummer/upGoods",
            data:{goodsId:goodsId},
            success:function (){
                $("#recycleTable").bootstrapTable("refresh")
                alert("恢复成功");
            },
            error:function (){
                alert("恢复失败")
            }
        })
    }

    /**
     * 彻底删除
     */
    function deleteThisGoods(goodsId){
        $.ajax({
            url:"/goodsConsummer/deleteThisGoods",
            data: {goodsId:goodsId},
            success:function (){
                $("#recycleTable").bootstrapTable("refresh");
                alert("已经彻底删除")
            },
            error:function (){
                alert("删除失败")
            }
        })
    }
</script>
</html>